f90_gc: Fortran Garbage Collector Module

Contents

Name

f90_gc - Module controlling the runtime garbage collector

Usage

USE F90_GC

Synopsis

Variables
DONT_EXPAND, DONT_GC, FULL_FREQUENCY, MAX_RETRIES, SILENT_GC.
Procedures
ENABLE_INCREMENTAL, EXPAND_HEAP, HEAP_SIZE, NCOLLECTIONS, SET_MAX_HEAP_SIZE.

Variable Description

  LOGICAL :: DONT_EXPAND = .FALSE.
If this variable is set to .TRUE., automatic heap expansion will only occur if necessary to satisfy an allocation request (normally the heap is expanded when an heuristic determines that it would be advantageous). This does not affect manual heap expansion (see EXPAND_HEAP). Setting the variable back to .FALSE. will re-enable the heuristic.

  LOGICAL :: DONT_GC = .FALSE.
If this variable is set to .TRUE., automatic garbage collection is inhibited. This does not affect manual garbage collection (see GCOLLECT). Setting the variable back to .FALSE. will re-enable automatic collection.

  INTEGER :: FULL_FREQUENCY = 4
This variable contains the frequency of full garbage collections when incremental collection is enabled (see ENABLE_INCREMENTAL_GC). The default setting means that when incremental collection is enabled, every fifth collection will be a full one.

  INTEGER :: MAX_RETRIES = 0
The maximum number of garbage collections attempted before reporting failure to the caller; if the allocation was not initiated by an ALLOCATE statement with a STAT= clause, this will result in program termination.

  LOGICAL :: SILENT_GC = .TRUE.
While this variable is set to .FALSE. informative messages are produced on each garbage collection.

Procedure Description

  SUBROUTINE ENABLE_INCREMENTAL_GC()
Enables incremental garbage collection. Full collections will still be performed with a frequency determined by the FULL_FREQUENCY variable.

  LOGICAL FUNCTION EXPAND_HEAP(N)
  INTEGER,INTENT(IN) :: N
This function attempts to expand the heap by N blocks (of 4K bytes), returning .TRUE. if and only if it is successful. The DONT_EXPAND variable does not affect this function.

Note that on some systems this may return a false indication of success as the operating system delays the actual allocation of memory until an attempt is made to use it - at which point the program may be aborted. Therefore this function should not be used to attempt to allocate all the virtual memory on a system.

  SUBROUTINE GCOLLECT()
Manually initiates a garbage collection. The DONT_GC variable does not affect this procedure.

  INTEGER FUNCTION HEAP_SIZE()
Returns the current size of the heap in bytes.

  INTEGER FUNCTION NCOLLECTIONS()
Returns the number of garbage collections that have been performed.

  SUBROUTINE SET_MAX_HEAP_SIZE(N)
  INTEGER,INTENT(IN) :: N
Sets the maximum size of the heap to N bytes. This will prevent the heap from automatic expansion beyond the specified limit, and prevent it from automatic expansion entirely if it is already beyond the limit.

See Also

f95(1), nag_modules(3).

Bugs

Please report any bugs found to "support@nag.co.uk" or "infodesk@nag.com", along with any suggestions for improvements.